Comments
-
Hi Jamie, thanks, the second link provides the solution! It explains the following: "There is a known issue with PowerShell Invoke-WebRequest and Invoke-RestMethod where the shell eats the response body when the status code is an error (4xx or 5xx). " And also provides the solution: "You can fetch the response body in your…
-
Yes, when I evaluate the exception via the catch block I get the following: ######################################### Invoke-RestMethod : The remote server returned an error: (400) Invalid request. In line:44 char:11 + $Result = Invoke-RestMethod -Uri "https://x.x.x.x:y.y.y.y/api/sonic ... +…
-
Hi Jamie, Thank you for your quick reply. I may not be understanding the answer correctly. I have little to no experience in calling API from Powershell with the Invoke-Restmethod method. The problem is that when the API call is successful, the response is filled and looks like this: ##################################### {…